﻿using DJY.Code;
using System.Web.Mvc;

namespace DJY.Web
{
    [HandlerLogin]
    public abstract class ControllerBase : Controller
    {
        [HttpGet]
        public virtual ActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public virtual ActionResult Form()
        {
            return View();
        }

        [HttpGet]
        public virtual ActionResult Details()
        {
            return View();
        }

        protected virtual ActionResult Success(string message, object data = null)
        {
            return Json(AjaxResult.OK(message,data), JsonRequestBehavior.AllowGet);
        }

        protected virtual ActionResult Error(string message, object data = null)
        {
            return Json(AjaxResult.Fail(message,data), JsonRequestBehavior.AllowGet);
        }
    }
}
